/*
 * @Author: hucc
 * @Date: 2021-09-26 09:37:50
 * @LastEditors: hucc
 * @LastEditTime: 2021-09-26 15:27:35
 * @Description: 
 */
//数组的不完全解构
//let [a, b] = [1, 2, 3]
//console.log(a, b); //1 2
// let [h, [i], j] = [1, [2, 3], 4];
// console.log(h, i, j); //1 2 4


//拓展运算符...
//...用在等号左边 有聚合的作用 生成新的对象或者数组
//...用在等号右边 有拆分、剥离的作用
// let [c, ...d] = [1, 2, 3]
// console.log(c, d); //1 [2,3]

//数组解构设置默认值 当解构能匹配到值时，默认值不会生效 匹配不到值，默认值生效
// let [e, f, g] = [1, 2]
// console.log(e, f, g); //1 2 undefined
//默认值也可以是函数,函数一定会有返回值，没有返回Undefined 
function myFun() {
    console.log("函数"); //函数
}
let [a1, b1, c1 = myFun()] = [1, 2]
console.log(a1, b1, c1); //1 2 undefined
myFun(); //函数

function test() {
    console.log("hello"); //hello
    //return 10; 有返回值 输出的m就是10
}
let [m = test()] = []
console.log(m); //undefined
test(); //hello
//console.log("123")//123 undefined